package com.mall.mina.core;

import lombok.Data;

//锁协议返回对象信息
@Data
public class LockResult {

    //操作是否成功
    private Boolean b;

    //操作码
    private String code;

    //操作描述
    private String message;

    //具体信息
    private LockMessage obj;

    public LockResult() {
        this.b = true;
    }

    public LockResult(String message) {
        this.b = false;
        this.message = message;
    }
    public static LockResult msg(String msg) {
        return restResult(false, "-1", msg);
    }

    private static LockResult restResult(boolean b, String code, String msg) {
        LockResult apiResult = new LockResult();
        apiResult.setB(b);
        apiResult.setCode(code);
        apiResult.setMessage(msg);
        return apiResult;
    }
}
